package Controllers;

import org.apache.log4j.Logger;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * Created by root on 17-6-11.
 */
@Controller
@RequestMapping("/messageServices")
public class messageController {
    private Logger LOGGER = Logger.getLogger(messageController.class);

    @RequestMapping(value = "/sendMessage",method = RequestMethod.POST)
    public ResponseEntity<String> senMessage(@RequestParam String message){
        LOGGER.info(message);
        return new ResponseEntity("OK"+message,HttpStatus.OK);
    }

    @RequestMapping(value = "/check",method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<String> checkStatus(){
        return new ResponseEntity("{\"status\": \"OK\"}", HttpStatus.OK);
    }

}
